package com.blue.base.demo.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

/**
 * 菜单类型枚举
 *
 * @author liulei
 * @version 1.0
 */
@Getter
public enum MenuTypeEnum implements IEnum<String> {

    /**
     * 是否是菜单
     */
    Y("Y", "是"), N("N", "按钮");

    @EnumValue
    String value;

    String message;

    MenuTypeEnum(String value, String message) {
        this.value = value;
        this.message = message;
    }

    /**
     * 根据value获取枚举
     */
    public static MenuTypeEnum getByValue(String value) {
        for (MenuTypeEnum ms : MenuTypeEnum.values()) {
            if (ms.getValue().equals(value)) {
                return ms;
            }
        }
        throw new IllegalArgumentException("不存在该菜单类型枚举");
    }

}
